#include<stdio.h>
int main()
{
	int a;
	scanf_s("%d", &a);
	if (a >= 100 && a < 1000)
	{
		int b, c, d, f;
		b = a / 100;
		c = a % 100 / 10;
		d = a % 100 - c * 10;
		f = d * 100 + c * 10 + b * 1;
		printf("%d", f);
	}
	else
	{
		printf("-1");
	}
	return 0;
}